#!/bin/bash

current_env=$1
echo "当前环境是:"${current_env}

cd git
npm install

if [ $current_env = "k8sdaily" ]; then
  npm run build:daily
  echo "这是k8sdaily构建"
elif [ $current_env = "k8spublish" ]; then
  npm run build:prod
  echo "这是k8spublish构建"
else
  echo "出错了_$current_env"
fi

mkdir -p ../dockers/cricketfront
cp -r dist/*  ../dockers/cricketfront/

ls -ll dist

cp -r  deploy/docker-config/conf/default.conf ../dockers/default.conf
cp -r  deploy/docker-config/conf/${current_env}.conf ../dockers/nginx.conf

cat ../dockers/default.conf


tag=""
echo "env is"${ENV}
tag=$(date  +"%Y%m%d%H%M%S")"_${current_env}"
echo $tag >  ../dockers/tag

cp deploy/docker-config/Dockerfile ../dockers

echo "6个文件，nginx.conf，default.conf，cricketfront, tag, Dockerfile"

ls -al ../dockers

